package org.example.constant;

/**
 * @author 米友仁
 * @title: DataYuZhi 数据正常阈值
 * @projectName yydj
 * @description: TODO
 * @date 2022/8/2713:54
 */
public enum DataYuZhi {
    /***
     * 心率 正常阈值
     */
    XIN_LV("心率", 60.0, 100.0, 1),
    /***
     * 高压 正常阈值
     */
    GAO_YA_ZHI("高压", 90, 130, 2),
    /***
     * 低压 正常阈值
     */
    DI_YA_ZHI("低压", 58, 85, 3),
    /***
     * 计步 正常阈值
     */
    YUN_DONG("计步", 8000, 12000, 4),
    /***
     * 睡眠 正常阈值
     */
    SHUI_MIAN("睡眠", 6, 8, 5),
    /***
     * 温度 正常阈值
     */
    TI_WENG("温度", 36, 37.1, 6),
    /***
     * 餐后血糖 正常阈值
     */
    XUE_TANG("餐后血糖", 3.9, 7.8, 7),

    /***
     * 餐前血糖 正常阈值
     */
    XUE_TANG_PRE("餐前血糖",3.9,6.1,15),

    /***
     * 总胆固醇 正常阈值
     */
    DAN_GU_CHUN("总胆固醇", 2.8, 5.18, 8),
    /***
     * 甘油三酯 正常阈值
     */
    GAN_YOU_SAN_ZHI("甘油三酯", 0.56, 1.72, 9),
    /***
     * 尿酸 正常阈值
     */
    NIAO_SUAN("尿酸", 89, 416, 10),
    /***
     * 心房颤动 正常阈值
     */
    XIN_FANG_CHAN_DONG("心房颤动", 350, 600, 11),
    /***
     * 血氧 正常阈值
     */
    XUE_YANG("血氧", 94, 99, 0),
    /**
     * 跌倒记录
     */
    DIE_DAO("跌倒记录", 12),
    /**
     * SOS预警
     */
    SOS("SOS预警", 13),
    /**
     * 脱手记录
     */
    TUO_SHOU("脱手记录", 14),

    /**
     * 心电
     */
    ECG("心电", 16);


    private String name;
    private double low;
    private double high;
    private int coding;

    DataYuZhi(String name, double low, double high) {
        this.name = name;
        this.low = low;
        this.high = high;
    }

    DataYuZhi(String name, double low, double high, int coding) {
        this.name = name;
        this.low = low;
        this.high = high;
        this.coding = coding;
    }

    DataYuZhi(String name, int coding) {
        this.name = name;
        this.coding = coding;
    }

    public int getCoding() {
        return coding;
    }

    public void setCoding(int coding) {
        this.coding = coding;
    }

    /**
     * 是否在阈值内
     *
     * @param value 值
     * @return boolean
     */
    public boolean isTrue(double value) {
        return value >= this.getLow() && value <= this.getHigh();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getLow() {
        return low;
    }

    public void setLow(double low) {
        this.low = low;
    }

    public double getHigh() {
        return high;
    }

    public void setHigh(double high) {
        this.high = high;
    }
}
